<?php

namespace Modules\Shop\System;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Modules\Shop\Entities\Order;

/**
 * 支付
 * @package Modules\Edu\Http\Controllers
 */
class PayController extends Controller
{
    /**
     * 支付成功通知，用于处理定单状态
     * @param string $orderSn 商家订单号
     * @param string $tradeNo 支付订单号
     * @return void
     */
    public function notify(string $orderSn, string $tradeNo)
    {
        $order = Order::where('sn', $orderSn)->firstOrFail();
        if ($order['state'] == 1) {
            $order['state'] = 2;
            $order->save();
        }
    }
}
